<?php

/**
 * Arquivo que conterá o bloco fique de olho na obra
 * 
 * @author Alberto Medeiros <albertomedeiros214@gmail.com>
 */
$arrObjFaseAgrupada = agrupar_por_data_por_titulo($view->result);

?>

<div class="venture-gallery" id='de-olho-na-obra'>
        <div class="container">
            <h3>Fique de olho na obra</h3>
            <div class="venture-tt-gallery">

                <ul class="nav nav-tabs" role="tablist" id="myTab">
                    <li class="active">
                        <a href="javascript:void(0)" role="tab" data-toggle="tab">Fases</a></li>
                </ul>

                <div class="tab-content">
                    <div class="tab-pane active datas-fase" >
                        <div class="col-md-6 row">
                            <div class="col-md-6 row">
                                <select name="datas-fases" class="datas-fases" id="datas-fases">
                                    <?php
                                        foreach($arrObjFaseAgrupada as $strOption => $arrObjFase):
                                    ?>
                                            <optgroup label="<?= $strOption ?>">
                                                
                                                <?php
                                                    foreach($arrObjFase as $strChave=>$objFase){
                                                ?>
                                                        <option value="<?= $objFase->nid  ?>" ><?= $strChave ?></option>
                                                <?php
                                                    }
                                                ?>
                                                    
                                            </optgroup>
                                            
                                    <?php        
                                        endforeach;
                                    ?>
                                </select>
                            </div>
                            <div id="objFase" class="col-md-12 " style="width: 211%; padding-right: 0px; padding-left: 0px;">
                                <?php
                                        foreach($arrObjFaseAgrupada as $strOption => $arrObjFase):
                                            foreach($arrObjFase as $strChave=>$objFase){
                                              $objFaseAtual =  $objFase->_field_data["nid"]["entity"];
                                ?>
                                                <div class="col-md-6 row itens-fase " style="float: left;">
                                                    <ul style="margin:10px 0 0 0;">
                                                        <?php
                                                            foreach($objFaseAtual->field_dados[key($objFaseAtual->field_dados)] as $arrValor):
                                                        ?>
                                                                <li>
                                                                    <i class="ico"></i>
                                                                    <div class="_tt"><?= $arrValor["first"] ?></div>
                                                                    <div class="_percent">
                                                                        <div class="line"></div>
                                                                        <div class="number"><?= $arrValor["second"] ?>%</div>
                                                                    </div>
                                                                </li>
                                                        <?php
                                                            endforeach;
                                                        ?>
                                                    </ul>
                                                </div>
                                                <div class="col-md-6 row itens-fase sem-titulo" style="float: right;margin-right: 0px;padding-right: 0px;padding-left: 76px;">
                                                    <?php 
                                                        if(!empty($objFaseAtual))
                                                            print drupal_render(node_view($objFaseAtual, "teaser")); 
                                                     ?>
                                                </div>
                                <?php
                                                break;
                                            }
                                            break;
                                        endforeach;
                                ?>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

